/*
 * PageList.java 1.0 Created on 2003. 2. 24.
 */
package com.zll.framework.util;

import java.text.*;
import java.util.*;
import java.io.*;
import java.util.regex.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;

import com.zll.framework.model.HashList;

public class StringUtil {

	public static int LINE_PER_PAGE	= 15;

	public static int PAGE_MOVE = 10;

	public static String home = "";


	public static String nvl(Object str)
	{
		if ("____.__.__".equals(str)) {
			str = "";
		}

		if (str == null) {
			return "";
		}
		else if (str instanceof java.lang.Integer) {
			return str.toString();
		}
		else {
			return (String)str;
		}
	}

	public static String nvl(Object str, String replace)
	{
		if ("____.__.__".equals(str)) {
			str = "";
		}

		if (str == null || str.equals("")) {
			return replace;
		}
		else {
			return (String)str;
		}
	}

	public static boolean isAlphaNumber(String str)
	{
		for (int i = 0; i < str.length(); i++)
		{
			char value = str.toUpperCase().charAt(i);

			if (value < 48 || value > 90 || ( value > 57 && value < 65))
			{
				return false;
			}
		}
		return true;
	}

	/**
	* 8859_1 에서 EUC-KR 로 인코딩 한다.
	* @param str 원본 String
	* @return String 변환된 내용
	*/
	public static String toHan(Object str){
		if (str == null)	return "";
		String rstr = "";
		try{
		  rstr=(str==null)?"":new String(((String)str).getBytes("8859_1"),"utf-8");
		} catch(java.io.UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		return rstr;
	}

	/**
	* 8859_1 에서 EUC-KR 로 인코딩 한다.
	* @param str 원본 String
	* @return String 변환된 내용
	*/
	public static String toEng(String str){
		if (str == null)	return null;
		String rstr=null;
		try{
		  rstr=(str==null)?"":new String(str.getBytes("euc-kr"),"8859_1");
		} catch(java.io.UnsupportedEncodingException e) {
		}
		return rstr;
	}

	/**
	* 8859_1 에서 EUC-KR 로 인코딩 한다.
	* @param str 원본 String
	* @return String 변환된 내용
	*/
	public static String decode(String str, String enc){
		if (str == null)	return "";
		String rstr = "";
		try{
			rstr = java.net.URLDecoder.decode(str, enc);
		} catch (java.io.UnsupportedEncodingException e) {
		}
		return rstr;
	}

	/**
	* 금액에 천단위 콤마를 찍는다.
	* @param	원본 숫자
	* @return	콤마 찍은 숫자.
	*/
	public static String toPrice(long sumPrice)
	{
		DecimalFormat df = new DecimalFormat("###,###,###");

		return df.format(sumPrice);
	}


	/**
	* 금액에 천단위 콤마를 찍는다.
	* @param	원본 숫자
	* @return	콤마 찍은 숫자.
	*/
	public static String toPrice(String sumPrice)
	{
		if (sumPrice == null || sumPrice.trim().equals("")) {
			return "";
		}

		DecimalFormat df = new DecimalFormat("###,###,###");

		return df.format(Long.parseLong(sumPrice));
	}

	/**
	* 금액에 천단위 콤마를 찍는다.
	* @param	원본 숫자
	* @return	콤마 찍은 숫자.
	*/
	public static String toEngPrice(String sumPrice)
	{
		if (sumPrice == null || sumPrice.trim().equals("")) {
			return "";
		}

		DecimalFormat df = new DecimalFormat("###,###,###.##");

		return df.format(Double.parseDouble(sumPrice));
	}

	/**
	* 날자형식을 반환
	* @param	원본 숫자
	* @return	콤마 찍은 숫자.
	*/
	public static String toDate(String aDate, String delimeter)
	{
		if (aDate == null) {
			return "";
		} else if (aDate.length() == 14) {
			return aDate.substring(0,4) + delimeter + aDate.substring(4,6) + delimeter + aDate.substring(6,8) 
					+ " " + aDate.substring(8,10) + ":" + aDate.substring(10,12) + ":" + aDate.substring(12);
		} else if (aDate.length() == 12) {
			return aDate.substring(0,4) + delimeter + aDate.substring(4,6) + delimeter + aDate.substring(6,8) + " " + aDate.substring(8,10) + ":" + aDate.substring(10);
		} else if (aDate.length() == 8) {
			return aDate.substring(0,4) + delimeter + aDate.substring(4,6) + delimeter + aDate.substring(6);
		} else if (aDate.length() == 6) {
			return aDate.substring(0,4) + delimeter + aDate.substring(4);
		} else if (aDate.length() == 4) {
			return aDate.substring(0,2) + delimeter + aDate.substring(2);
		} else {
			return aDate;
		}
	}

	/**
	* 날자형식을 반환
	* @param	원본 숫자
	* @return	콤마 찍은 숫자.
	*/
	public static String toDate(String aDate)
	{
		return toDate(aDate, "-");
	}

	/**
        * 날자형식을 반환
        * @param        원본 숫자
        * @return       콤마 찍은 숫자.
        */
	public static String toSimpleDate(String str, String filler)
	{
		if (str.length() == 8) {
			return str.substring(2,4) + filler + str.substring(4,6) + filler + str.substring(6);
		} else if (str.length() == 6) {
			return str.substring(2,4) + filler + str.substring(4);
		} else {
			return str;
		}
	}

	/**
        * 날자형식을 반환
        * @param        원본 숫자
        * @return       콤마 찍은 숫자.
        */
	public static String toSDate(String str)
	{
		if (str.length() == 8) {
			return str.substring(4,6) + "/" + str.substring(6);
		} else {
			return str;
		}
	}


    /**
    * 날자형식을 반환
    * @param        원본 숫자
    * @return       콤마 찍은 숫자.
    */
    public static String toEngDate(String str, String filler, boolean bool)
    {
		int pos = 0;

		if (bool) pos = 2;

        if (str.length() == 8) {
                return str.substring(4,6) + filler + str.substring(6) + filler + str.substring(pos,4);
        } else if (str.length() == 6) {
                return str.substring(4) + filler + str.substring(pos,4);
        } else {
                return str;
        }
    }

	/**
	* 날자형식을 반환
	* @param	원본 숫자
	* @return	콤마 찍은 숫자.
	*/
	public static String fromDate(String aDate)
	{
		if (aDate == null) {
			return "";
		} else {
			return aDate.replaceAll("-", "");
		}
	}

	/**
	* 날자형식을 반환
	* @param	원본 숫자
	* @return	콤마 찍은 숫자.
	*/
	public static String toOX(String sYN)
	{
		if ("Y".equals(sYN)) {
			return "O";
		} else if ("N".equals(sYN)) {
			return "X";
		} else {
			return sYN;
		}
	}

	public static int parseInt(String str)
	{
		if (str == null || str.equals("")) {
			return 0;
		} else {
			try {
				return Integer.parseInt(str);
			} catch (Exception e) {
				return 0;
			}
		}
	}



	public static String checked(Object str, Object str2)
	{
		if (str == null || str2 == null)	return "";

		if (str.equals(str2))				return "checked=\"checked\"";
		else								return "";
	}

	public static String selected(Object str, Object str2)
	{
		if (str == null || str2 == null)	return "";

		if (str.equals(str2))				return "selected=\"selected\"";
		else								return "";
	}

	public static String toHTML(String org)
	{
		return org.replaceAll("\n", "<br/>");
	}

	public static String toTag(String org)
	{
		org = org.replaceAll("'", "&apos;");

		return org;
	}

	public static String noBR(String org)
	{
//		return org.replaceAll("\n", "<BR>");

		if (org == null)	return org;

		StringBuffer temp = new StringBuffer();

		int pos = -1;
		for (int i = 0; i < org.length(); i++)
		{
			if (org.charAt(i) == 13)
			{
				temp.append(org.substring(pos+1, i));
				pos = i+1;
			}
		}

		temp.append(org.substring(pos+1));

		return temp.toString();
	}

	public static String toReply(String org)
	{
//		return org.replaceAll("\n", "<BR>");

		if (org == null)	return org;

		StringBuffer temp = new StringBuffer();

		int pos = -1;
		for (int i = 0; i < org.length(); i++)
		{
			if (org.charAt(i) == 13)
			{
				temp.append(">" + org.substring(pos+1, i));
				pos = i+1;
			}
		}

		temp.append(">" + org.substring(pos+1));

		return temp.toString();
	}


	public static String substring(String org, int lastIndex)
	{
		return substring(org, 0, lastIndex, "..");
	}


	public static String substring(String org, int lastIndex, String tail)
	{
		return substring(org, 0, lastIndex, tail);
	}


	public static String substring(String org, int startIndex, int lastIndex)
	{
		return substring(org, startIndex, lastIndex, "");
	}

	public static String substring(String org, int startIndex, int lastIndex, String tail)
	{
		if (org == null || org.equals(""))	return "";

		if (org.length() <= lastIndex)
		{
			return org;
		}

		return org.substring(startIndex, lastIndex) + tail;
	}

	// fromIndex로 부터 뒤로 str을 찾는다.
	public static int firstIndexOf(String org, String str, int fromIndex)
	{
		int index = -1;

		for (int i = fromIndex; i > -1; i--)
		{
			if (org.charAt(i) == str.charAt(0))
			{
				boolean isSame = true;

				// 나머지부분이 일치하는 지 확인
				for (int j = 1; j < str.length(); j++)
				{
					if (org.charAt(i+j) != str.charAt(j))
					{
						isSame = false;
					}
				}

				if (isSame)
				{
					index = i;
					break;
				}
			}
		}

		return index;
	}


	public static String getCurrentDate()
	{
		Calendar cal = Calendar.getInstance();
		SimpleDateFormat df = new SimpleDateFormat("yyyy년 M월 d일 a h시 m분");
		String strDate = df.format(cal.getTime());

		return strDate;
	}

	public static String today() {
		return toString(Calendar.getInstance());
	}

	/**
	 * today : YYYYMMDD
	 */
	public static String addDays(String yyyymmdd, int days) {
		GregorianCalendar cal = toCalendar(yyyymmdd);
		cal.add(GregorianCalendar.DATE, days);
		return toString(cal);
	}

	public static String toString(Calendar cal) {
		SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
		return df.format(cal.getTime());
	}

	public static GregorianCalendar toCalendar(String yyyymmdd) {
		int yyyy 	= Integer.parseInt(yyyymmdd.substring(0,4));
		int mm		= Integer.parseInt(yyyymmdd.substring(4,6));
		int dd		= Integer.parseInt(yyyymmdd.substring(6));

		return new GregorianCalendar(yyyy, mm-1, dd,0,0,0);
	}

	public static String noData(int cnt)
	{
		if (cnt == 0) {
			return "<tr height=50 class=pad_l10><td align=center>검색된 데이타가 없습니다.</td></tr>";
		} else {
			return "";
		}
	}



	public static String noHTML(String html)
	{
	    Pattern p = Pattern.compile("\\<(\\/?)(\\w+)*([^<>]*)>");
	    Matcher m = p.matcher(html);
	    return m.replaceAll("");
	}


	/**
  * replaces the pattern string in the source string with replace string
  * @author  Lee Hyun Sung in Love & Thanks
  * @param strSource  the string to be processed
  * @param strPat     the string pattern to be replaced
  * @param strReplace the replace string
  * @return  the newly formed replaced string else empty string
  */
	public static String  replaceAll(String strSource, String strPat, String strReplace)
	{
		int sPos = strSource.indexOf(strPat);
		StringBuffer newSource = new StringBuffer();

		while (sPos > -1)
		{
			strSource = strSource.substring(0, sPos) + strReplace + strSource.substring(sPos + strPat.length());
			sPos = strSource.indexOf(strPat);
		}

		return strSource;
	}


	/**
  * replaces the pattern string in the source string with replace string
  * @author  Lee Hyun Sung in Love & Thanks
  * @param strSource  the string to be processed
  * @param strPat     the string pattern to be replaced
  * @param strReplace the replace string
  * @return  the newly formed replaced string else empty string
  */
	public static String  replaceFirst(String strSource, String strPat, String strReplace)
	{
		int sPos = strSource.indexOf(strPat);
		StringBuffer newSource = new StringBuffer();

		if (sPos > -1)
		{
			strSource = strSource.substring(0, sPos) + strReplace + strSource.substring(sPos + strPat.length());
			sPos = strSource.indexOf(strPat);
		}

		return strSource;
	}


	//public static void setPaging(String xml, String sql, HashMap infos) throws Exception {
	public static void setPaging(HashMap infos) throws Exception {
		if (infos.get("curr_page") == null) {
			//infos.put("start_num",	0);
			//infos.put("end_num",	Integer.parseInt(StringUtil.nvl(infos.get("end_num"),"1")));
		}
		else {
			int currPage	= Integer.parseInt((String)infos.get("curr_page"));
			int startNum	= (currPage - 1) * Integer.parseInt(StringUtil.nvl(infos.get("line_per_page"),"10"));	
			int endNum		= Integer.parseInt(StringUtil.nvl(infos.get("line_per_page"),"10"));	

			infos.put("start_num",	new Integer(startNum));
			infos.put("end_num",	new Integer(endNum));
			//infos.put("total_count", DBManager.executeQuery(xml, sql, infos).getInt("total_count", 0));
		}
	}
	
	public static String getPageHtml(HashMap infos) {
		return getPageHtml(infos, "#nohref");
	}
	/**
     * curPage : 현제페이지
     * totalCount : 젠체 게시물수
     * blockCount : 한 페이지의 게시물의 수
     * blockPage : 한화면에 보여질 페이지의 수
     * */
    public static String getPageHtml(HashMap infos, String curUrl) {

   	 	int curPage 	= Integer.parseInt(StringUtil.nvl(infos.get("curr_page"),"1"));//vo.getCurPage();
   	 	int totalCount 	= Integer.parseInt(StringUtil.nvl(infos.get("total_count"),"0"));	//vo.getTotCount();
   	 	int blockCount 	= Integer.parseInt(StringUtil.nvl(infos.get("line_per_page"),"10"));	
   	 	int blockPage 	= Integer.parseInt(StringUtil.nvl(infos.get("paging_size"),"10"));	
//   	 	int startCount 	= 0;
//   	 	int endCount 	= 0;


   	 	StringBuffer pagingHtml = new StringBuffer();

        // 전체 페이지 수 //Math.ceil 올림
        int totalPage = (int) Math.ceil((double) totalCount / blockCount);
        if (totalPage == 0) {
            totalPage = 1;
        }

       // 연산에 오류가 날수도 있기때문에 오류 보정
        // 현재 페이지가 전체 페이지 수보다 크면 전체 페이지 수로 설정
        if (curPage > totalPage) {
            curPage = totalPage;
        }

       // 현재 페이지의 처음과  마지막 글의 번호 가져오기
//        startCount = (curPage - 1) * blockCount + 1;
//        endCount = curPage * blockCount;

       // 시작페이지와 마지막페이지 값 구하기
       int startPage = (int) ((curPage - 1) / blockPage) * blockPage + 1;
        int endPage = startPage + blockPage - 1;

       // 연산에 오류가 날수도 있기때문에 오류 보정
        // 마지막페이지가 전체페이지수보다 크면 전체페이지 수로 설정하기
        if (endPage > totalPage) {
            endPage = totalPage;
        }

       // 실제 HTML을 만드는 부분
        // 이전 block 페이지
        
        String and = (curUrl.indexOf("?") > -1) ? "&" : "?";

        pagingHtml = new StringBuffer();
        
        pagingHtml.append("<span>");
        
        //first
        if ("#nohref".equals(curUrl)) {
    		pagingHtml.append("<a class=\"first\" href=\"#nohref\" onclick=\"fnSearch(1)\">처음</a>");
    	} else {
    		pagingHtml.append("<a class=\"first\" href=\""+ curUrl + and + "curr_page=1\">처음</a>");
    	}
        
        //prev
        if (curPage > blockPage) {
        	if ("#nohref".equals(curUrl)) {
        		pagingHtml.append("<a class=\"prev\" href=\"#nohref\" onclick=\"fnSearch(" + (startPage - 1) + ")\">");
        	} else {
        		pagingHtml.append("<a class=\"prev\" href=\""+ curUrl + and + "curr_page=" + (startPage - 1) + "\">");
        	}
        	pagingHtml.append("<</a>");
        }

        
        for (int i = startPage; i <= endPage; i++) {
        	if (i > totalPage) {
        		break;
        	}
        	if (i == curPage) {
        		pagingHtml.append("<a class=\"active\" href=\"#nohref\">");
        		pagingHtml.append(i);
        		pagingHtml.append("</a>");
        	} else {
        		if (curUrl.equals("#nohref")) {
        			pagingHtml.append("<a href=\"#nohref\" onclick=\"fnSearch(").append(i).append(")");
        		} else if (curUrl.indexOf("?") > -1) {
	        		pagingHtml.append("<a href=\""+ curUrl +"&curr_page=").append(i);
	        	} else {
	        		pagingHtml.append("<a href=\""+ curUrl +"?curr_page=").append(i);
	        	}
        		pagingHtml.append("\">");
        		pagingHtml.append(i);
        		pagingHtml.append("</a>");
        	}
        }

        // next
        if (totalPage - startPage >= blockPage) {
        	if ("#nohref".equals(curUrl)) {
        		pagingHtml.append("<a class='next' href=\"#nohref\" onclick=\"fnSearch(" + (endPage + 1) + ")\">");
        	} else {
        		pagingHtml.append("<a class='next' href=\""+ curUrl + and + "curr_page=" + (endPage + 1) + "\">");
        	}
        	pagingHtml.append(">");
        	pagingHtml.append("</a>");
        }
        
        //last
        if ("#nohref".equals(curUrl)) {
    		pagingHtml.append("<a class='last' href=\"#nohref\" onclick=\"fnSearch(" + (totalPage) + ")\">마지막</a>");
    	} else {
    		pagingHtml.append("<a class='last' href=\""+ curUrl + and + "curr_page=" + (totalPage) + "\">마지막</a>");
    	}
        
        pagingHtml.append("</span>");

        return pagingHtml.toString();
    }


    /**
	* 해당파일을 copy하는 메소드
	* @param slc => 원본파일경로
	* @param tlc => 복사될파일경로
	* @throws IOException
	*/
	public static void copyFile(File slc , File tlc) throws IOException{
		//소스가 디렉토리인 경우
		//-->해당 디렉토리의 모든 파일을 타겟 디렉토리에 복사
		if(slc.isDirectory()){
			if(!tlc.exists()){
				tlc.mkdir();
			}

			String[] children = slc.list();
			for(int i=0; i<children.length; i++){
				copyFile(new File(slc,children[i]),new File(tlc,children[i]));
			}
		}

		//소스가 파일인경우
		else{
			InputStream in = new FileInputStream(slc);
			OutputStream out = new FileOutputStream(tlc);

			byte[] buf = new byte[1024];
			int len;
			while((len = in.read(buf)) > 0){
				out.write(buf,0,len);
			}
			in.close();
			out.close();
		}
	}


	public static String replaceContent(String content, String dir)  throws IOException
	{
		String realPath	= "/home/hosting_users/joinhawaii/www/";	//request.getRealPath("/");

		while (content.indexOf("img/temp/") > -1)
		{
			int idx = content.indexOf("img/temp/");
			String fileName = content.substring(idx+9, content.indexOf(".", idx)+4);

			content = StringUtil.replaceFirst(content, "img/temp", dir);


			File f = new File(realPath + "img/temp/" + fileName);

			StringUtil.copyFile(f, new File(realPath + dir+"/"+fileName));
			f.delete();
		}

		return content;
	}


	public static String latlng(String xml, String name, String latlng) {
		String value = "";
		try
		{

			DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();   //XML을 다루는 CLASS
			DocumentBuilder parser = dbf.newDocumentBuilder();                   //XML을 다루는 CLASS
			Document doc  = parser.parse(new StringBufferInputStream(xml));

			Element root = doc.getDocumentElement();
			NodeList nodeList = root.getElementsByTagName(name);
			Node location = nodeList.item(0);


			NodeList locList = location.getChildNodes();
			for (int i = 0; i < locList.getLength(); i++) {
				Node node = locList.item(i);
				if (node.getNodeName() == latlng) {
					Node textNode = node.getChildNodes().item(0);
					value = textNode.getNodeValue();
					break;
				}
			}
		}
		catch (Exception e) {

		}

		return value;
	}


	public static String lpad(String str, int len, String addStr) {
        String result = str;
        int templen   = len - result.length();

        for (int i = 0; i < templen; i++){
              result = addStr + result;
        }

        return result;
    }

	public static String makeRadio(HashList list, String name, String selectedValue) {
		//<input type="radio" name="familiy" id="familiy01" ></input><label for="familiy01"><span>일반</span></label>
		StringBuffer sb = new StringBuffer();

		for (int i = 0; i < list.size(); i++) {
			sb.append("<input type=\"radio\" class=\"radio\" name=\""+name+"\" id=\""+name+i+"\" value=\""+list.get("code",i)+"\" ");
			if (list.get("code",i).equals(selectedValue)) {
				sb.append(" checked=\"checked\" ");
			}
			sb.append(" /><label class=\"radio\" for=\""+name+i+"\">"+list.get("code_name",i)+"</label>");
		}

		return sb.toString();
	}

//	public static String makeCheckBox(HashList list, String name, String selectedValue) {
//
//		StringBuffer sb = new StringBuffer();
//
//		for (int i = 0; i < list.size(); i++) {
//			String title = "";
//			if ("".equals(list.get("code_desc",i))) {
//				title = "";
//			} else {
//				title = " title=\"" + list.get("code_desc",i) + "\"";
//			}
//			if (!"".equals(list.get("code",i)) && selectedValue.indexOf(list.get("code",i)) > -1) {
//				sb.append(" <span class=\"checkbox checked\"><nobr><input type=\"checkbox\" name=\""+name+"."+name+"\" id=\""+name+i+"\" value=\""+list.get("code",i)+"\" ");
//				sb.append(" checked=\"checked\" ");
//				sb.append(" /><label class=\"checked\" "+title+" for=\""+name+i+"\">"+list.get("code_name",i)+"</label></nobr></span>");
//			} else {
//				sb.append(" <span class=\"checkbox\"><nobr><input type=\"checkbox\" name=\""+name+"."+name+"\" id=\""+name+i+"\" value=\""+list.get("code",i)+"\" ");
//				sb.append(" /><label "+title+" for=\""+name+i+"\">"+list.get("code_name",i)+"</label></nobr></span>");
//			}
//		}
//
//		return sb.toString();
//	}

	public static String makeOption(HashList list, String selectedValue) {

		StringBuffer sb = new StringBuffer();

		for (int i = 0; i < list.size(); i++) {
			sb.append("<option value=\""+list.get("code",i)+"\" ");
			if (list.get("code",i).equals(selectedValue)) {
				sb.append(" selected=\"selected\" ");
			}
			sb.append(" >"+list.get("code_name",i)+"</option>");
		}

		return sb.toString();
	}


	public static String makeOptionByGroup(HashList list, String selectedValue) {

		StringBuffer sb = new StringBuffer();

		String optionGroup	 	= "";
		boolean optGroupOpen	= false;


		for (int i = 0; i < list.size(); i++) {
			if (optionGroup.equals("") || !optionGroup.equals(list.get("option_group",i))) {
				if (optGroupOpen) {
					sb.append("</optgroup>");
					optGroupOpen = false;
				}
				sb.append("<optgroup label=\""+list.get("option_group",i)+"\">");
				optGroupOpen = true;
			}

			sb.append("<option value=\""+list.get("code",i)+"\" ");
			if (selectedValue.equals(list.get("code",i))) {
				sb.append(" selected=\"selected\" ");
			}
			sb.append(" >"+list.get("code_name",i)+"</option>");


			optionGroup = list.get("option_group",i);
		}

		if (optGroupOpen) {
			sb.append("</optgroup>");
		}

		return sb.toString();
	}
	
	
	public static String getFileName() {
		Calendar cal = Calendar.getInstance();
		SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
		return df.format(cal.getTime()) + (new Random().nextInt(99));
	}
	
	public static String getFileId() {
		Calendar cal = Calendar.getInstance();
		SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
		return df.format(cal.getTime()) + StringUtil.lpad(String.valueOf((int)(Math.random()*10000)),4,"0");
	}

	
	public static String getFileExtIcon(String ext) {
		String fileName = "ico_file.gif";
		if ("xls".equals(ext) || "xlsx".equals(ext) || "ppt".equals(ext) || "pptx".equals(ext)
				|| "doc".equals(ext) || "docx".equals(ext) || "hwp".equals(ext)) {
			fileName = "ico_" + ext + ".gif";
		}
		
		return fileName;
	}
}
